#ifndef  __WSS_H__
#define  __WSS_H__

#include "cc.h"
#include "common.h"
#include "user.h"
#include "timer.h"
#include "part.h"

#define WSS_CHANNEL_NUMBER 96

typedef struct _wss_chaalram_info_registernnel{
    int32_t channel;
    int32_t port;
    float atten;
}wss_channel;

typedef struct _wss_slices{
    int32_t channel;
    int begin;
    int end;
    int custom_begin;
    int custom_end;
}wss_slices;

typedef struct _wss_oss{
    int ready;
    int hss;
    int lss;
    int module_restarted;
    int optics_not_ready;
    int loading_calibration;
    int start_up_active;
}wss_oss;

typedef struct _wss_hss{
    int case_temp;
    int internal_temp;
    int temp_control;
    int vcom_control;
    int thermal_shutdown;
    int power_supply;
    int power_rail;
}wss_hss;

typedef struct _wss_lss{
    int case_temp;
    int internal_temp;
    int temp_control;
    int vcom_control;
    int thermal_shutdown;
    int power_supply;
    int power_rail;
}wss_lss;


typedef struct _wss_alarm_info{
    wss_oss oss;
    wss_hss hss;
    wss_lss lss;
}wss_alarm_info;

typedef struct _wss_device{    
    char busy;
    int exit;
    int uart_fd;
    int sample_flag;
    int print_flag;
    char* device_name;
    timer* timer;

    char fpga_version[32];
    char firmware_version[32];
    char serial_number[32];
    char manufacturing_date[32];
    char module_id[64];

    wss_alarm_info alarm_info;

    char case_temp[8];
    char inernal_temp[8];

    int save_begin;
    int channel_spacing;
    int channels_count;
    wss_channel channels[WSS_CHANNEL_NUMBER];    
    int slices_count;
    wss_slices slices[WSS_CHANNEL_NUMBER];
    int save_end;

}wss_device;

void* wss_thread(void* param);

cJSON* wss_parse(CMD_ID id,cJSON* param);
void wss_alarm_register(device_alarm_list* p_user);
#endif // ! __WSS_H__
